package com.lanhai.enums;

public enum TransferType {
	TZ(0, "00", "停止对接"),
	WC(1, "01", "完成传输/退回主路"),
	SCC(2, "02", "上层传出"),
	SCR(3, "03", "上层传入"),
	XCC(4, "04", "下层传出"),
	XCR(5, "05", "下层传入"),
	SCXR(6, "06", "上出下入"),
	SRXC(7, "07", "上入下出"),
	SZC(8, "08", "上左传出"),
	SZR(9, "09", "上左传入"),
	SRC(10, "0A", "上右传出"),
	SRR(11, "0B", "上右传入"),
	XZC(12, "0C", "下左传出"),
	XZR(13, "0D", "下左传入"),
	XRC(14, "0E", "下右传出"),
	XRR(15, "0F", "下右传入");
	
	private TransferType(Integer code, String hex, String name){
		this.code = code;
		this.name = name;
		this.hex = hex;
	}
	private Integer code;
	private String name;
	private String hex;
	public Integer getCode() {
		return code;
	}
	public void setCode(Integer code) {
		this.code = code;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
    public String getHex() {
		return hex;
	}
	public void setHex(String hex) {
		this.hex = hex;
	}
	
	public static String getValueByCode(Integer code){
        for(TransferType tf:TransferType.values()){
        	if(code == tf.getCode()){
                return tf.getName();
            }
        }
        return  null;
    }

	public static String getHexByCode(Integer code){
        for(TransferType tf:TransferType.values()){
            if(code == tf.getCode()){
                return tf.getHex();
            }
        }
        return  null;
    }
	
}
